package com.ry.vo;

import lombok.Data;

/**
 * 请求的响应
 */
@Data
public class Response {

	public static final String SUCCESS = "success";
	public static final String FAILURE = "failure";

	private String status;
	private Object data;
	private String errorMsg;

	public Response() {
	}

	public Response(String status){
		this.status = status;
	}

	public Response(String status, Object data) {
		this.status = status;
		this.data = data;
	}

	public Response(String status, String errorMsg) {
		this.status = status;
		this.errorMsg = errorMsg;
	}

	public static Response failure(String errorMsg){
		return new Response(FAILURE,errorMsg);
	}

	public static Response success(){
		return new Response(SUCCESS);
	}

	public static Response success(Object data){
		return new Response(SUCCESS,data);
	}

}
